package adavance.socket;

import java.io.IOException;
import java.net.ServerSocket;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author oldliu
 * @since 1.0
 */
public class ThreadPoolServer {
    public static void main(String[] args) {
        ExecutorService es = Executors.newFixedThreadPool(10);
        try {
            ServerSocket st=new ServerSocket(8001);
            System.out.println("服务器启动成功，监听在8001端口");
            while (true){
                //提交任务
                es.submit(new FileSendThread2(st.accept()));//提交了任务
            }
        } catch (IOException e) {
            e.printStackTrace();
        }


    }
}
